﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Collections;

namespace Siav
{
    public partial class frmRptClientes : Form
    {
        public frmRptClientes()
        {
            InitializeComponent();
        }

        private void frmRptClientes_Load(object sender, EventArgs e)
        {
            using (SiavEntities Entidades = new SiavEntities())
            {
                TodosClientes reportDocument = new TodosClientes();              
                reportDocument.SetDataSource(RetornaClientes());
                crvViewer.ReportSource = reportDocument;
            }
        }

      
        /// <summary>
        /// Retorna os clientes do banco para o relatório
        /// </summary>
        /// <returns>Data Table</returns>
        public static DataTable RetornaClientes()
        {
            using (SiavEntities Entidades = new SiavEntities())
            {
                IQueryable _query = (from cli in Entidades.Clientes
                                     orderby cli.RazaoSocial ascending
                                     select cli);

                return Utilidades.RetornarDataTable(_query);
            }
        }
    }
}
